package com.ruoyi.user.model.pojo.request.app;


import com.ruoyi.common.core.annotation.MobileValid;
import com.ruoyi.common.core.enums.LoginEnum;
import com.ruoyi.user.model.constant.AppValidGroup;
import com.ruoyi.user.model.enums.LoginStrategy;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Data
@ApiModel(description = "登录请求参数")
public class LoginRequest {
    @Schema(name = "phone",description = "登录账号")
    @NotBlank(message = "账号不可为空", groups = {AppValidGroup.Password.class, AppValidGroup.Code.class})
    @MobileValid(message = "账号或密码错误", groups = {AppValidGroup.Password.class, AppValidGroup.Code.class})
    @ApiModelProperty("登录账号")
    private String phone;

    @Schema(name = "secretKey",description = "密码或验证码")
    @NotBlank(message = "密码或验证码不可为空", groups = {AppValidGroup.Password.class, AppValidGroup.Code.class})
    @Length(min = 6, max = 18, message = "账号密码或验证码错误", groups = {AppValidGroup.Password.class, AppValidGroup.Code.class})
    @ApiModelProperty("安全密钥=>登陆密码或验证码")
    private String secretKey;

    @NotNull(message = "请选择登录策略", groups = {AppValidGroup.Password.class, AppValidGroup.Code.class, AppValidGroup.Alipay.class, AppValidGroup.Wechat.class, AppValidGroup.Phone.class})
    @ApiModelProperty("登录策略")
    @Schema(description = "请选择登录策略")
    private LoginStrategy loginStrategy;

    @NotNull(message = "请选择登录类型", groups = {AppValidGroup.Password.class, AppValidGroup.Code.class, AppValidGroup.Alipay.class, AppValidGroup.Wechat.class})
    @ApiModelProperty("登录类型")
    @Schema(description = "登录类型")
    private LoginEnum loginEnum;

    @ApiModelProperty("一键登录token")
    private String token;
}

